home *** CD-ROM | disk | FTP | other *** search
- /* ------------------- ShowInit.c ----------------------------*/
- /*
- Simple INIT notification routine in LightSpeedC 2.15
- */
-
- #include <QuickDraw.h>
- #include <C_config.h>
-
- #define CKSM(i) \
- asm { \
- ROL #1,i \
- EOR #0x1021,i \
- }
-
- typedef struct QuickDraw { /* QuickDraw globals */
- char private[76];
- long randSeed;
- BitMap screenBits;
- Cursor arrow;
- Pattern dkGray;
- Pattern ltGray;
- Pattern gray;
- Pattern black;
- Pattern white;
- GrafPtr thePort;
- } QuickDraw;
-
- extern short myH : 0x92C; /* CurApName + 28 */
- extern short myCheck: 0x92E; /* CurApName + 30 */
- extern long oldSig: 0xA78; /* ApplScratch */
- extern short oldH: 0xA7E; /* ApplScratch + 6 */
-
- extern void ShowINIT (Integer);
-
- void ShowINIT(iconID)
- register Integer iconID; /* ICN# resource ID */
- {
- register Handle h;
- register short i;
- Rect srcRect, destRect;
- BitMap myBitMap;
- GrafPort myPort;
- QuickDraw qdGlobals;
- Ptr localA5;
-
- asm {
- MOVE.L A5,-(SP)
- LEA.L localA5,A5
- }
- if (!(h = GetResource('ICN#', iconID)))
- goto out; /* Error */
- InitGraf(&qdGlobals.thePort);
- OpenPort(&myPort);
-
- i = myH;
- CKSM(i);
- if (i == myCheck)
- i = myH;
- else
- if (oldSig == 'Paul')
- i = oldH;
- else
- i = 8;
- destRect.bottom = myPort.portRect.bottom - 8;
- destRect.left = myPort.portRect.left + i;
- destRect.top = destRect.bottom - 32;
- destRect.right = destRect.left + 32;
- i += 40;
- myH = i;
- CKSM(i);
- myCheck = i;
-
- HLock(h);
- srcRect.top = srcRect.left = 0;
- srcRect.bottom = srcRect.right = 32;
- myBitMap.rowBytes = 4;
- myBitMap.bounds = srcRect;
- myBitMap.baseAddr = *h + 128; /* Skip to mask */
- CopyBits(&myBitMap, &myPort.portBits, &srcRect, &destRect, srcBic, 0L);
- myBitMap.baseAddr = *h; /* Now draw icon */
- CopyBits(&myBitMap, &myPort.portBits, &srcRect, &destRect, srcOr, 0L);
- HUnlock(h);
- ReleaseResource(h);
-
- ClosePort(&myPort);
- out:
- asm {
- MOVE.L (SP)+,A5
- }
- }
- /* end of ShowInit.c */
-